import QtQuick 2.0
import QtQuick.Controls 2.5

Rectangle {
    id: root
    radius: 4
    property alias _text: t.text
    property int _fontSize: 13
    signal clicked()
    color: _normal_color

    property color _normal_color: "#3986FF"
    property color _hover_color: "#5F9DFF"
    property color _pressed_color: "#096DD9"
    property color _disable_color: "#BDD6FC"

    onEnabledChanged: {
        if( !enabled ){
            root.color = _disable_color
        }else{
            root.color = _normal_color
        }
    }

    MouseArea {
        anchors.fill: parent
        hoverEnabled: true
        onClicked: { root.clicked(); root.focus = true }
        onEntered: { color = _hover_color }
        onExited: { color = _normal_color }
        onPressed: { color = _pressed_color }
        onReleased: { color = _normal_color }
    }

    Text {
        id: t
        text: root.text
        anchors.centerIn: parent
        font.pixelSize: _fontSize
        color: "white"
    }

}
